import * as Vue from "vue";
import { createPinia } from "pinia";
import Antd from "ant-design-vue";

import "@/utils/global_app";
import App from "./App.vue";
import "./styles/index.less";
import i18n from "./locales/index"; // 引入
import router from "./router";
import "./router/permission";
import Ant3uI from "ant3-ui";
// import Ant3uI from "/Users/xuyifei/Documents/study/npm/ant_vue3_ui_ts/lib/index"; // 这种引入不能打包之后不能使用

const app = Vue.createApp(App);

app.use(createPinia());
app.config.globalProperties.myApp = window.myApp;

app.use(Antd);
app.use(i18n);
app.use(Ant3uI, {
  uploadUrl: "https://s.youdi.net/router/upload/save/file", // 初始化上传路径
  dealTableRes: (res: any) => {
    return {
      total: res.pageInfo.total,
      list: res.data,
    };
  },
  dealTableSearch: (params: any) => {
    params.pageSize = params.size || 10;
    params.pageIndex = params.page || 1;
    delete params.page;
    delete params.size;

    return params;
  },
});
app.use(router);
app.mount("#app");
// 暴露全局对象到window
window.Vue = Vue;
